layui.use(function() {
	var form = layui.form;
	var table = layui.table;
	var laydate = layui.laydate;

	laydate.render({
		elem: '.input-time',
		type: 'time'
	});

	laydate.render({
		elem: '.input-date',
		type: 'date'
	});

	laydate.render({
		elem: '.input-datetime',
		type: 'datetime'
	});
	
	//////////////////////////
	
	form.on('submit(sreach)', function(data) {
		$("#pageIndex").val(1);
		return true;
	});
	
	form.on('checkbox(checkall)', function(data) {
		if (data.elem.checked) {
			$('tbody input').prop('checked', true);
		} else {
			$('tbody input').prop('checked', false);
		}
		form.render('checkbox');
	});
	
	//////////////////////////
	
	form.on('submit(table-search)', function(data) {
		var field = data.field;
		table.reload('table-main', {
			page:{curr:1},
			where : convertFormParams(field)
		});
		return false;
	});
	
});